package com.xudu.utils;

/**
 * ClassName: Calculate
 * Description:
 *
 * @Author xudu
 * @Create 2024/4/25
 */
public class CalculateUtil {

    private double sum;


    // 添加学生的成绩
    public synchronized double addGrade(double grade) {
        sum += grade;
        return sum;
    }

    // 计算平均成绩
    public synchronized double getAverageGrade(int length) {
        return sum / length;
    }

}
